﻿using B.S.Traceability.Myproject.Domain;
using B.S.Traceability.Myproject.ErrorCode;
using B.S.Traceability.MyRead.Api.Appicant.Command.InformationCommand;
using B.S.Traceability.MyRead.Api.DTOs;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Traceability.MyRead.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class InformationController : ControllerBase
    {
        private readonly IMediator mediator;

        public InformationController(IMediator mediator ) 
        {
            this.mediator = mediator;
        }


        /// <summary>
        /// 查询管理
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// 
        [HttpGet]
        public async Task<APIPaing<GetInformationDTO>> Getinformation([FromQuery]GetInformationCommand request) 
        {

            return await mediator.Send(request);
        }

        /// <summary>
        /// 查询商品
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// 

        [HttpGet]
        public async Task<APIResult<List<ShopMondel>>> GetShop([FromQuery]GetShopCommand request)
        {

            return await mediator.Send(request);
        }
    }
}
